package marcus.list;

import java.util.List;


public class ListTraversal {
	private static int i = 0;
	private static int result = -10000;

	public static int getNthValue (List<Integer> list, int n, int p){
		System.out.println("p is " + p);
		System.out.println("n is " + n);
		System.out.println("list size is " + list.size());
		if (p < list.size() -1 ){
			 ListTraversal.getNthValue(list, n, p +1);
		}
		i++;
		System.out.println("now p is " + p);
		
		if (i == n){
			result = list.get(p);
		}
		
		return result;
	}
	
	public static void reset(){
		i=0;
		result = -10000;
	}
}
